<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>买入信号结果</title>
    <style>
        body {
            font-family: sans-serif;
            margin: 0;
            padding: 2em;
            background: #f8f8f8;
            text-align: center;
        }
        h1 {
            color: #333;
            margin-bottom: 1.5em;
        }
        .result-container {
            max-width: 80%;
            margin: 0 auto;
            background: #fff;
            padding: 2em;
            border: 1px solid #ddd;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 1em;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        th {
            background: #f4f4f4;
            font-weight: bold;
        }
        tr:nth-child(even) {
            background: #f9f9f9;
        }
        .back-button {
            display: inline-block;
            padding: 10px 20px;
            margin-top: 1em;
            background: #007bff;
            color: #fff;
            text-decoration: none;
            border-radius: 4px;
        }
        .back-button:hover {
            background: #0056b3;
        }
    </style>
</head>
<body>
    <h1>买入信号结果 - {{ strategy | capitalize }}</h1>
    <div class="result-container">
        {% if signals %}
            <table>
                <thead>
                    <tr>
                        <th>股票代码</th>
                        <th>日期</th>
                        <th>SMA5</th>
                        <th>SMA10</th>
                        <th>SMA20</th>
                        <th>High20</th>
                        <th>RSI</th>
                        <th>ATR</th>
                        <th>触发条件</th>
                    </tr>
                </thead>
                <tbody>
                    {% for signal in signals %}
                        <tr>
                            <td>{{ signal.ticker }}</td>
							<td>{{ signal.date }}</td>
                            <td>{{ signal.SMA5 }}</td>
                            <td>{{ signal.SMA10 }}</td>
                            <td>{{ signal.SMA20 }}</td>
                            <td>{{ signal.High20 }}</td>
                            <td>{{ signal.RSI }}</td>
                            <td>{{ signal.ATR }}</td>
                            <td>
                                <ul>
                                    {% for condition in signal.trigger_conditions %}
                                        <li>{{ condition }}</li>
                                    {% endfor %}
                                </ul>
                            </td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        {% else %}
            <p>无买入信号生成。</p>
        {% endif %}
        <a href="/" class="back-button">返回</a>
    </div>
</body>
</html>
